package Test;

import java.util.Scanner;

public class test02 {
    public static void main(String[] args) {
        int num1, num2;
        int count=0;
        Scanner input=new Scanner(System.in);
        num1= input.nextInt();
        num2=input.nextInt();

        if(num1==num2){
            System.out.println(0);
        }
        while(num1!=num2){
            if(num1>num2||(num1-1)*2>num2){
                num1--;
            }else {
                num1*=2;
            }
            count++;
        }
        System.out.print(count);
    }
}
